package com.itboye.textileexpes.repository;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.interfaces.IUserRepository;
import com.itboye.textileexpes.beans.AppUpdateBean;
import com.itboye.textileexpes.beans.Category_TypeTwo;
import com.itboye.textileexpes.beans.ForresterBeans;
import com.itboye.textileexpes.beans.PersonDataBean;
import com.itboye.textileexpes.beans.RootBean;
import com.itboye.textileexpes.interfaces.IAppUpdate;
import com.itboye.textileexpes.interfaces.ICategory;
import com.itboye.textileexpes.interfaces.IMainCategory;
import com.itboye.textileexpes.json.ByJsonRequest.Builder;
import com.itboye.textileexpres.base.BaseErrorListener;
import com.itboye.textileexpres.base.BaseNetRepository;
import com.itboye.textileexpres.base.BaseSuccessReqListener;

public class MainCategoryRepository extends BaseNetRepository implements
		IMainCategory<ForresterBeans> {
	/***
	 * 查询类目
	 */
	public static final String Category = "By_Category_queryMainCategory";
	// 收藏类目
	public static final String Collection = "By_Favorites_cate";
	public static final String Category_son = "By_Category_querySubCategory";

	public MainCategoryRepository(ICompleteListener listener) {
		// TODO Auto-generated constructor stub
		super(listener);
	}

	@Override
	public void add(ForresterBeans model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<ForresterBeans>>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("api_ver", apiVer);
		map.put("app_type", "android");

		(new Builder<List<ForresterBeans>>())
				.setTypeVerParamsAndReturnClass(Collection, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<ForresterBeans>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void delete(ForresterBeans model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(ForresterBeans model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(ForresterBeans model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<ForresterBeans>>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("api_ver", apiVer);
		map.put("app_type", "android");

		(new Builder<List<ForresterBeans>>())
				.setTypeVerParamsAndReturnClass(Category, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<ForresterBeans>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public List<ForresterBeans> query(ForresterBeans model) {
		// TODO Auto-generated method stub
		return null;
	}

}
